<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="SubcategoriaCreateDlg" widgetVar="SubcategoriaCreateDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.CreateSubcategoriaTitle}">
            <h:form id="SubcategoriaCreateForm">
                <h:panelGroup id="display">
                    <p:commandButton actionListener="#{subcategoriaController.create}" value="#{bundle.Save}" update="display,:SubcategoriaListForm:datalist,:growl" oncomplete="handleSubmit(args,'SubcategoriaCreateDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" immediate="true" onclick="SubcategoriaCreateDialog.hide()"/>
                    <br /><br />
                    <p:panelGrid columns="2" rendered="#{subcategoriaController.selected != null}">
                        <p:outputLabel for="categoriaId" value="Categoria" />
                        <p:selectOneMenu id="categoriaId" value="#{subcategoriaController.selected.categoriaId}" required="true" requiredMessage="Selecione uma categoria! ">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{categoriaController.itemsAvailableSelectOne}" var="categoria" itemLabel="#{categoria.descricao}" itemValue="#{categoria}" />
                        </p:selectOneMenu>                        
                        <p:outputLabel value="#{bundle.CreateSubcategoriaLabel_descricao}" for="descricao" />
                        <p:inputText id="descricao" value="#{subcategoriaController.selected.descricao}" title="#{bundle.CreateSubcategoriaTitle_descricao}" required="true" requiredMessage="#{bundle.CreateSubcategoriaRequiredMessage_descricao}"/>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{subcategoriaController.create}" value="#{bundle.Save}" update="display,:SubcategoriaListForm:datalist,:growl" oncomplete="handleSubmit(args,'SubcategoriaCreateDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" immediate="true" onclick="SubcategoriaCreateDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
